#include<stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include<stdlib.h>
#include<string.h>
int main(int argc, char *argv[])
{

		int fd=-1;
		int ret=-1;
		char readbuf[100];
		int i=0;
		fd=open(argv[1],O_RDWR);
		if(fd==-1){

				printf("Open error!\n");
				return -1;
		}
		
		ret=read(fd,readbuf,100);

		if(ret<0){
				printf("Read error!\n");
				return -1;
		}
		else{
				printf("读取成功\n");
		}


	/*	FILE *fp;
		fp=fopen("test.txt","rb");
		if(fp==NULL){

				printf("Failure to open file\n");
				return 0;
		}
		char ch;
		char STR[1000];
		int i,n;
		i=0;
		while((ch=fgetc(fp))!=EOF){

				STR[i]=ch;
				i++;
				//putchar(ch);
		}
		STR[i]='\0';
	*/
		i=strlen(readbuf);
		close(fd);
		od(readbuf,i);
		return 0;
}
	

